package com.gxa.meiye.admin.controller.lzj;


import com.gxa.meiye.admin.service.RefundService;
import com.gxa.meiye.core.common.ResponseData;
import com.gxa.meiye.core.pojo.domain.lzj.Refund;
import com.gxa.meiye.core.utils.TencentCOSUtil;
import io.swagger.annotations.Api;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.multipart.MultipartFile;

@Api(value = "ReturnPay",tags = "退款接口")
@Controller
public class ReturnMoneyController {
    @Autowired
    private RefundService refundService;
    //查询退款原因
    @ResponseBody
    @GetMapping("/returnpay/reason")
    public ResponseData queryAll(){
        return refundService.queryAll();
    }
    //提交退款原因
    @ResponseBody
    @PostMapping("/returnpay/add")
    public ResponseData tijiao(MultipartFile file, Refund refund){
        String img = TencentCOSUtil.uploadfile(file);
        System.out.println(img);
        return refundService.addReFund(img,refund.getOrderNumber(),refund);
    }

}
